#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

void main() {
  printf("父进程pid:%d\n", getpid());
  pid_t f_pid = fork();
  printf("fork返回，f_pid:%d\n", f_pid);
  if (f_pid) {
      printf("进入父进程分支, pid:%d\n", getpid());
      while(1) {
        printf("睡眠100秒\n");
        sleep(100);
      }
  } else {
      printf("进入子进程分支, pid:%d\n", getpid());
  }
}
